//
//  YYJLGraphicListController.m
//  YuanyangJinlou
//
//  Created by mac004 on 2017/1/12.
//  Copyright © 2017年 suli19910309@qq.com. All rights reserved.
//  图文资料列表

#import "YYJLGraphicListController.h"
#import "YYJLGraphicDetailController.h"
#import "YYJLcurriculum1Cell.h"
@interface YYJLGraphicListController ()<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
{
    UICollectionView* _collectionView;
}



@end

@implementation YYJLGraphicListController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setTitleView:@"图文资料列表"];
    [self setBackItem];
    [self onCreateUI];
    
}
-(void)onCreateUI{
    UICollectionViewFlowLayout*layout=[[UICollectionViewFlowLayout alloc]init];
    
    _collectionView=[[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-44*PER_HEIGHT-NAV_HEIGHT) collectionViewLayout:layout];
    
    _collectionView.delegate=self;
    _collectionView.dataSource=self;
    _collectionView.backgroundColor=[UIColor clearColor];
    [self.view addSubview:_collectionView];
    
    [_collectionView registerClass:[YYJLCurriculum1Cell class] forCellWithReuseIdentifier:@"cell"];
}
#pragma mark--collectionView
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    
  
        YYJLGraphicDetailController * datail =[[YYJLGraphicDetailController alloc]init];
        [self.navigationController pushViewController:datail animated:YES];
  
    
    
}
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
    return CGSizeMake(171*PER_WIDTH, 242.5*PER_HEIGHT);
}
-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{
    return UIEdgeInsetsMake(10*PER_HEIGHT, 11*PER_WIDTH, 10*PER_WIDTH, 11*PER_HEIGHT);
}

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return 8;
}
-(UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    YYJLCurriculum1Cell*cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    cell.backgroundColor=[UIColor whiteColor];
        cell.isVieo=NO;
    
    return cell;
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
